home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / gnu / gawk / gawk213b.zoo / test / chem / readme < prev   
Text File  |  1990-02-05  |  8KB  |  271 lines

  1. INSTALLATION
  2.  
  3. The file chem invokes chem.awk, which is where the dirty
  4. work gets done.  chem.awk tells pic to include a copy
  5. of chem.macros;  you will need to change a pathname on
  6. the 2nd line of chem.awk.
  7.  
  8. You need current versions of awk and pic.  In particular,
  9. your awk has to support functions and your pic has to know
  10. about the copy statement.  So if you get weird messages
  11. from either of those, it's time to update.
  12.  
  13. this version of awk is available from the AT&T Toolchest,
  14. for a fee of $300.  For more
  15. information, call 201-522-6900 and log in as "guest".
  16. The current version of pic is part of the documentor's
  17. workbench version 2.0, or the typesetter-independent
  18. troff package;  both of these are available from AT&T
  19. Software Sales at POBox 25000, Greensboro, NC 27420, 800-828-unix.
  20. You don't want to know why there are different places and
  21. different sources.
  22.  
  23. There are several test files called *.p.
  24.  
  25.  
  26. INTRODUCTION
  27.  
  28. "chem" is yet another preprocessor like eqn, pic, etc., 
  29. this time for producing chemical structure diagrams.
  30. Today's version is best suited for organic chemistry
  31. (bonds, rings) and it's excruciatingly slow sometimes.
  32. Who knows what the future may hold.
  33.  
  34. In a style reminiscent of eqn and pic, diagrams are
  35. written in a special language and occur in a document
  36. surrounded by lines beginning
  37.     .cstart
  38. and
  39.     .cend
  40. (in the first column, naturally).  Anything outside
  41. these is copied through intact;  whatever is between
  42. .cstart and .cend is converted into pic commands to
  43. draw the diagram.
  44.  
  45. So as a bare minimum,
  46.  
  47.     .cstart
  48.     CH3
  49.     bond
  50.     CH3
  51.     .cend
  52.  
  53. prints two CH3 groups with a bond between them.
  54. To actually print this, you must run chem, pic,
  55. troff, and your output filter on whatever file
  56. contains the input:
  57.  
  58.     chem [file...] | pic | troff ... | ...
  59.  
  60. (By the way, chem needs the current version of awk;
  61. you will get some mysterious error messages from awk
  62. if your version is too old.  You will also profit from
  63. having sensible and consistent definitions for the PS
  64. and PE macros.)
  65.  
  66.  
  67. THE LANGUAGE
  68.  
  69. The chem input language is rather small.  It provides
  70. bonds of several styles, moieties (e.g., C, NH3, ...),
  71. rings of several styles, and a way to glue them together
  72. as desired.  In addition, since chem is a pic preprocessor,
  73. it's possible to include pic statements in the middle of
  74. a diagram to draw things not provided for by chem itself.
  75.  
  76. Bonds:
  77.  
  78.     bond [direction] [length n] [from Name | picstuff]
  79.  
  80. draws a single bond in direction from nearest corner of Name
  81. "bond" can also be double bond, front bond, back bond, etc.
  82. (We'll get back to "Name" in a minute.)
  83.  
  84. "direction" is the angle in degrees (0 up, positive clockwise)
  85. or a direction word like up, down, sw (= southwest), etc.
  86. If no direction is specified, the bond goes in the current
  87. direction (usually that of the last bond).
  88.  
  89. Normally the bond begins at the last object placed;  this
  90. can be changed by naming a "from" place.  For instance,
  91. to make a simple alkyl chain:
  92.  
  93.     CH3
  94.     bond        (this one goes right from the CH3)
  95.     C        (at the right end of the bond)
  96.     double bond up    (from the C)
  97.     O        (at the end of the double bond)
  98.     bond right from C
  99.     CH3
  100.  
  101. A length in inches may be specified to override the default length.
  102. Other pic commands can be tacked on to the end of a bond command,
  103. to created dotted or dashed bonds or to specify a "to" place.
  104.  
  105.  
  106. Names:
  107.  
  108. In the alkyl chain above, notice that the carbon atom C
  109. was used both to draw something and as the name for a place.
  110. A moiety always defines a name for a place;  you can use
  111. your own names for places instead, and indeed, for rings
  112. you will have to.  A name is just
  113.  
  114.     Name: ...
  115.  
  116. "Name" is often the name of a moiety like CH3, but it
  117. needn't be.  Any name that begins with a capital letter
  118. and contains only letters and numbers is ok:
  119.  
  120.     First:  bond
  121.         bond 30 from First
  122.  
  123. draws something like
  124.  
  125.          /
  126.     ____/
  127.  
  128.  
  129. Moieties:
  130.  
  131. A moiety is a string of characters beginning with a capital letter,
  132. such as N(C2H5)2.  Numbers are converted to subscripts (unless
  133. they appear to be fractional values, as in N2.5H).  The moiety
  134. names itself after special characters have been stripped out:
  135. N(C2H5)2) has the name NC2H52.
  136.  
  137. BP is a special "branch point" (i.e., line crossing) that doesn't print.
  138.  
  139. Normally a moiety is placed right after the last thing mentioned,
  140. but it may be positioned by pic-like commands, e.g.,
  141.  
  142.     CH3 at C + (0.5,0.5)
  143.  
  144. Text within quotes "..." is treated more or less like a
  145. moiety except that no changes are made to the quoted part.
  146.  
  147.  
  148. Rings:
  149.  
  150. There are lots of rings, but only 5 and 6-sided rings get
  151. much support.  "ring" by itself is a 6-sided ring;
  152. "benzene" is the benzene ring with a circle inside.
  153. "aromatic" puts a circle into any kind of ring.
  154.  
  155.     ring [pointing up|right|left|down] [aromatic] 
  156.         [put Mol at n] [double i,j k,l ...]
  157.         [picstuff]
  158.  
  159. The vertices of a ring are numbered 1,2,... from the vertex
  160. that points in the natural compass direction.  So for a
  161. hexagonal ring with the point at the top, the top vertex is 1,
  162. while if the ring has a point at the east side, that is
  163. vertex 1.  This is expressed as
  164.  
  165.     R1: ring pointing up
  166.     R2: ring pointing right
  167.  
  168. The ring vertices are named .V1 .. .Vn, with .V1 in the
  169. pointing direction.  So the corners of R1 are R1.V1 (the "top"),
  170. R1.V2, R1.V3, R1.V4 (the "bottom"), etc., whereas for R2,
  171. R2.V1 is the rightmost vertex and R2.V4 the leftmost.  These
  172. vertex names are used for connecting bonds or other rings.
  173. For example:
  174.  
  175.     R1: benzene pointing right
  176.     R2: benzene pointing right with .V6 at R1.V2
  177.  
  178. creates two benzene rings connected along a side.
  179.  
  180. Interior double bonds are specified as "double n1,n2 n3,n4 ...";
  181. each number pair adds an interior bond.  So the alternate form
  182. of a benzene ring is
  183.  
  184.     ring double 1,2 3,4 5,6
  185.  
  186. Heterocycles (rings with something other than carbon at a vertex)
  187. are written as "put X at V", as in
  188.  
  189.     R: ring put N at 1 put O at 2
  190.  
  191. In this heterocycle, R.N and R.O become synonyms for R.V1 and R.V2.
  192.  
  193. There are two 5-sided rings.  "ring5" is pentagonal with a side
  194. that matches the 6-sided ring;  it has four natural directions.
  195. A "flatring" is a 5-sided ring created by chopping one corner
  196. of a 6-sided ring so that it exactly matches the 6-sided rings.
  197.  
  198. The description of a ring has to fit on a single line.
  199.  
  200.  
  201. Miscellaneous:
  202.  
  203. The specific construction
  204.  
  205.     bond... ; moiety        (spaces matter!)
  206.  
  207. is equivalent to
  208.  
  209.     bond
  210.     moiety
  211.  
  212. Otherwise, each item has to be on a separate line (and only one line).        
  213.  
  214. A period "." in column 1 signals a troff command, which is copied
  215. through as is.
  216.  
  217. A line whose first non-blank character is a # is treated as a comment.
  218.  
  219. A line whose first word is "pic" is copied through as is after
  220. the "pic" has been removed.
  221.  
  222. The command
  223.  
  224.     size n
  225.  
  226. scales the diagram so it looks plausible at point size n
  227. (default is 10 point).
  228.  
  229. Anything else is assumed to be pic and is copied through with
  230. a label.
  231.  
  232. WISH LIST
  233.  
  234. It's too slow (but it's too early in the game to optimize).
  235.  
  236. Error checking is minimal;  errors are usually detected
  237. and reported in an oblique fashion by pic.
  238.  
  239. There's no library or file inclusion mechanism, and there's
  240. no shorthand for repetitive structures.
  241.  
  242. The extension mechanism is to create pic macros, but these
  243. are tricky to get right and don't have all the properties
  244. of built-in objects.
  245.  
  246. There's no in-line chemistry yet (e.g., analogous to
  247. the $...$ construct of eqn).
  248.  
  249. There is no way to control entry point for bonds on groups.
  250. Normally a bond connects to the carbon atom if entering from
  251. the top or bottom and otherwise to the nearest corner.
  252.  
  253. Bonds from substituted atoms on heterocycles do not join
  254. at the proper place without adding a bit of pic.
  255.  
  256. There is no decent primitive for brackets.
  257.  
  258. Text (quoted strings) doesn't work very well.
  259.  
  260. A squiggle bond is needed.
  261.  
  262.  
  263. COMPLAINTS
  264.  
  265. If something doesn't work, or if you can see a way to
  266. make something better, let us know.
  267.  
  268.     jon bentley, x2315, research!jlb
  269.     lynn jelinski, x2511, physics!lwj
  270.     brian kernighan, x6021, research!bwk
  271.